<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>射击成绩管理</title>
<%@ include file="/common/include.jsp"%>
<script type="text/javascript">
	function del(id){
		$.get("${pageContext.request.contextPath}/user/delUser?id=" + id,function(data){
			if("success" == data.result){
				alert("删除成功");
				window.location.reload();
			}else{
				alert("删除失败");
			}
		});
	}
	
	$(function(){  
	    $("#list").jqGrid({  
	        url : "${pageContext.request.contextPath}/user/list",  
	        contentType : 'application/json',  
	        mtype : "post",  
	        datatype : 'json',  
	        prmNames : {search : "search"},  
	        jsonReader : {id : "0", repeatitems : false, userdata : "userdata"},  
	        height : "auto",  
	        colNames : ["ID", "姓名", "年龄"],  
	        colModel : [{name:"id", index:"id", hidden:true},  
	                    {name:"userName", index:"userName"},  
	                    {name:"age", index:"age"}],   
	       	sortname:'id',
			sortorder:'desc',
	        pager : "#pager",  
	        autoWidth : true,  
	        rowNum : 10,  
	        rownumbers : true,  
	        viewrecords: true,  
	        caption : "用户列表"  
	        });  
	    $(window).bind('resize', function() {  
	        $("#list").setGridWidth($("#_grid").width() - 10);  
	    }).trigger('resize');  
	    jQuery("#list").jqGrid('navGrid', '#pager', {});  
	}); 
</script>
</head>
<body>
	<h6><a href="${pageContext.request.contextPath}/user/toAddUser">添加用户</a></h6>
	<div id="_grid" style="width: 100%; * width: 99%; zoom: 1;">  
		<table id="list" width="100%"></table>   
		<div id="pager"></div>  
	</div>
</body>
</html>